<%#
kind: PXEGrub2
name: Preseed default PXEGrub2
model: ProvisioningTemplate
oses:
- Debian
- Ubuntu
%>
#
# This file was deployed via '<%= template_name %>' template
#
# Supported host/hostgroup parameters:
#
# blacklist = module1, module2
#   Blacklisted kernel modules
#
# lang = en_US
#   System locale
#
<%
  os_major = @host.operatingsystem.major.to_i
  os_name  = @host.operatingsystem.name

  options = []
  if host_param('blacklist')
    options << host_param('blacklist').split(',').collect{|x| "#{x.strip}.blacklist=yes"}.join(' ')
  end
  if os_name == 'Debian'
    options << "auto=true"
    options << "domain=#{@host.domain}"
  else
    options << 'console-setup/ask_detect=false console-setup/layout=USA console-setup/variant=USA keyboard-configuration/layoutcode=us localechooser/translation/warn-light=true localechooser/translation/warn-severe=true'
  end
  options << "locale=#{host_param('lang') || 'en_US'}"
  
  # send PXELinux "IPAPPEND 2" option along
  options.push("BOOTIF=01-$net_default_mac")

  options = options.join(' ')

  if (os_name == 'Ubuntu' && os_major > 12) || (os_name == 'Debian' && os_major > 8)
    efi_suffix = 'efi'
  else
    efi_suffix = ''
  end
-%>
set default=0
set timeout=<%= host_param('loader_timeout') || 10 %>

menuentry '<%= template_name %>' {
  linux<%= efi_suffix %>  <%= @kernel %> interface=auto url=<%= foreman_url('provision')%> ramdisk_size=10800 root=/dev/rd/0 rw auto hostname=<%= @host.name %> <%= options %>
  initrd<%= efi_suffix %> <%= @initrd %>
}

<%= snippet_if_exists(template_name + " custom menu") %>
